import { BasicColumn } from '/@/components/Table';
import { FormSchema } from '/@/components/Form';
import { useI18n } from '/@/hooks/web/useI18n';

import { GetPartAndDocTypeXL } from '/@/api/demo/system';

const { t } = useI18n();
export function getPartAndDrawingColumns(): BasicColumn[] {
  return [
    {
      title: t('routes.demo.PartAndDrawingSettings.partProperty'),
      dataIndex: 'partId',
      width: 150,
      fixed: 'left',
    },
    {
      title: t('routes.demo.PartAndDrawingSettings.relation'),
      dataIndex: 'relationship',
      width: 120,
    },
    {
      title: t('routes.demo.PartAndDrawingSettings.consistentNumber'),
      dataIndex: 'aboutNumber',
      width: 120,
    },
    {
      title: t('routes.demo.PartAndDrawingSettings.drawingProperty'),
      dataIndex: 'docId',
      width: 120,
    },
    {
      title: t('routes.demo.PartAndDrawingSettings.generalDescription'),
      dataIndex: 'description',
      width: 120,
    },
  ];
}

export function getPartAndDrawModalForm(): FormSchema[] {
  return [
    {
      field: 'partId',
      component: 'ApiSelect',
      label: t('routes.demo.PartAndDrawingSettings.partProperty'),
      required: true,
      componentProps: {
        placeholder: t('routes.demo.PartAndDrawingSettings.partPropertyPlaceholder'),
        api: GetPartAndDocTypeXL,
        resultField: 'partList',
        labelField: 'value',
        valueField: 'label',
      },
    },
    {
      field: 'docId',
      component: 'ApiSelect',
      label: t('routes.demo.PartAndDrawingSettings.drawingProperty'),
      required: true,
      componentProps: {
        placeholder: t('routes.demo.PartAndDrawingSettings.drawingPropertyPlaceholder'),
        api: GetPartAndDocTypeXL,
        resultField: 'docList',
        labelField: 'value',
        valueField: 'label',
      },
    },
    {
      field: 'relationship',
      component: 'Select',
      label: t('routes.demo.PartAndDrawingSettings.relation'),
      defaultValue: '',
      componentProps: {
        placeholder: t('routes.demo.PartAndDrawingSettings.relationPlaceholder'),
        options: [
          {
            label: t('routes.demo.PartAndDrawingSettings.same'),
            value: '',
          },
          {
            label: t('routes.demo.PartAndDrawingSettings.front'),
            value: '前',
          },
          {
            label: t('routes.demo.PartAndDrawingSettings.back'),
            value: '后',
          },
        ],
      },
    },
    {
      field: 'aboutNumber',
      component: 'Input',
      label: t('routes.demo.PartAndDrawingSettings.consistentNumber'),
      componentProps: {
        placeholder: t('routes.demo.PartAndDrawingSettings.consistentNumberPlaceholder'),
      },
    },
    {
      field: 'description',
      component: 'InputTextArea',
      label: t('routes.demo.PartAndDrawingSettings.generalDescription'),
      componentProps: {
        placeholder: t('routes.demo.PartAndDrawingSettings.generalDescriptionPlaceholder'),
      },
    },
    {
      field: 'Divider',
      component: 'Divider',
      label: t('routes.demo.PartAndDrawingSettings.tip'),
    },
  ];
}

export function getInboundSettingModalForm(): FormSchema[] {
  return [
    {
      field: 'rkOption',
      component: 'RadioGroup',
      label: '',
      defaultValue: '1',
      componentProps: {
        options: [
          {
            label: t('routes.demo.PartAndDrawingSettings.inboundSelect1'),
            value: '1',
          },

          {
            label: t('routes.demo.PartAndDrawingSettings.inboundSelect2'),
            value: '2',
          },
        ],
      },
    },
  ];
}
